package com.jymj.entity.zjd;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jymj.common.validator.group.AddGroup;
import com.jymj.common.validator.group.UpdateGroup;
import com.jymj.entity.HujiZhaiEntity;
import com.jymj.entity.YlEntity;
import com.jymj.entity.huji.ZhaiEntity;
import com.jymj.enumEntity.zjd.ApplyEnum;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * Created by ljj on 2018/8/30.
 */
@Data
public class ApplyEntity implements Serializable {
    private Integer id;
    //记录人
    private Integer userId;
    //'院落id'
    @NotBlank(message="院落id不能为空", groups = {AddGroup.class,UpdateGroup.class})
    private Integer ylId;
    private YlEntity ylEntity;
    //'申请状态
    private Integer sptype;
    private String sptypeText;
    //'申请时间'
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date sqDate;
    //'审批时间'
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date spdate;
    //'审批内容'--备注
    private String  spcontent;
    //'审批建筑面积'
    private BigDecimal spjzmj;
    //是否删除 false否  true是
    private boolean isdelete=false;
    //'验收时间'
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date ysdate;
    //'验收人'
    private Integer ysUserId;
    //'当事人姓名'
    @NotBlank(message="当事人姓名不能为空", groups = {AddGroup.class,UpdateGroup.class})
    private String name;
    //'当事人电话'
    private String iphone;
    //'紧急电话'
    private String jjphone;
    //待申请时间
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date dspdate;
    //施工时间
    private Date sgdate;
    //是否有审批通知书 有-true  无-false
    private boolean ishave=false;
    //'审批人'
    private Integer apUserId;
    //审批意见
    private String remark;
    //'待验收'
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date dysdate;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date bhDate;

    private BigDecimal zjdArea;//宅基地面积
    private BigDecimal fjzdArea;//房基占地面积
    private BigDecimal jdgd;//基底高度
    private String address;//地址
    private String east;//东至
    private String south;//南至
    private String west;//西至
    private String north;//北至
    private Integer landtype;//地类
    private Integer jflx;//建房类型
    private String xybztjbh;//选用的通用标准图集编号
    private String ftysjbz;//非通用设计图采用的设计标准
    private String xzqmc;
    private String code;
    private String zhen;
    private String titanic;//文号
    private String headTitanic;//文号头
    private String geometry;
    private String center;
    private Integer household;


    //申请资料
    private List<ApplyFileEntity> applyFileList;
    //施工中子项目
    private ApplyChildEntity applyChildEntity;
    //驳回信息
    private List<ApplyLogEntity> applyLogEntityList;
    private Integer counts;

    private List<ZhaiEntity> zhaiEntities;//户籍信息
    private ZhaiEntity zhaiEntity;//户主信息
    private List<ApplyFwEntity> applyFwEntities;//院落房屋信息


    public boolean getIshave() {
        if(ishave!=true){
            return false;
        }
        return ishave;
    }

    public void setIshave(boolean ishave) {
        this.ishave = ishave;
    }

    public String getSptypeText(){
        if(getSptype() !=null){
            return ApplyEnum.getName(getSptype());
        }
        return null;
    }
}
